package com.test

import org.glassfish.jersey.server.ResourceConfig
import org.glassfish.jersey.server.spring.SpringLifecycleListener
import org.glassfish.jersey.server.spring.scope.RequestContextFilter
import org.glassfish.jersey.test.JerseyTest

import javax.ws.rs.core.Application

/**
 * 测试基类
 * Created by three on 14-7-29.
 */
public abstract class BaseJerseyServiceTest extends JerseyTest {

    @Override
    protected Application configure() {
//        forceSet(TestProperties.CONTAINER_PORT, "0");
        ResourceConfig rc = new ResourceConfig()//new MyApplication()
                .packages("com.frame.exception")
                .register(SpringLifecycleListener.class)
                .register(RequestContextFilter.class)

        ;
        TestUtil.registerHK2Services(rc);
        rc.property("contextConfigLocation", "classpath:spring-unit-test.xml");
        return configure(rc);
    }

    protected abstract Application configure(ResourceConfig rc);
}
